#include <reg52.h>
#include <stdio.h>
#include <string.h>

void init_com()
{
   SCON = 0x50;
   TH2 = 0xFF;
   TL2 = 0xFD;
   RCAP2H = 0xFF;
   RCAP2L = 0xFD;

   /*****************/
   TCLK = 1;
   RCLK = 1;
   C_T2 = 0;
   EXEN2 = 0;

   /*****************/
   TR2 = 1;
   TI = 1;
}

void main()
{
   char input[10];

   init_com();

   while (1)
   {
      printf("witing you input:");
      scanf("%s", input);
      if (strcmp(input, "op1"))
      {
         P2 = 0x0F;
      }
      else
      {
         P2 = 0x55;
      }
   }
}